using System.Collections.Generic;
using Magiq.Sql.Tests.TestModel;
using Magiq.Tests;
using NUnit.Framework;

namespace Magiq.Sql.Tests {
    [TestFixture]
    public class MagiqToSqlInsertsTest : BaseMagiqProviderInsertsTest<LinqToSqlTestClass1, LinqToSqlTestClass1Inheritor> {
        protected override IMagiqTestConfigurator GetConfigurator() {
            return MagiqToSqlTestConfigurator.Current;
        }

        [Test]
        public void ShouldNotInsertIntoAList() {
            TestClass1s.Insert(x => new LinqToSqlTestClass1 {
                AnotherStringProperty = x.StringProperty,
                IntProperty = x.AnotherIntProperty,
                AnotherIntProperty = 4,
                StringProperty = "lala"
            }).Into(new List<LinqToSqlTestClass1>());
            MagiqMock.AssertWasUsed();
        }

        [Test]
        public void ShouldInsertRegularListIntoLinqToSql() {
            new List<LinqToSqlTestClass1>().Insert(x => new LinqToSqlTestClass1 {
                AnotherStringProperty = x.StringProperty,
                IntProperty = x.AnotherIntProperty,
                AnotherIntProperty = 4,
                StringProperty = "lala"
            }).Into(Destination);
        }
    }
}